<template>
    <div>
        <el-form :inline="true" >
      <el-form-item label="名称：">
        <el-input  placeholder="请输入名称" v-model="searchParams.key" />
      </el-form-item>
      <el-form-item label="日期：">
        <el-date-picker
        v-model="timeRange"
        type="daterange"
        value-format="YYYY-MM-DD"
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
        :size="size"
      />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSearch">搜索</el-button>
      </el-form-item>
    </el-form>
    </div>
</template>

<script>
export default {
  data () {
    return {
      timeRange: [],
      searchParams: {
        key: '',
        start: '',
        end: ''
      }
    }
  },
  methods: {
    onSearch () {
      this.searchParams.start = this.timeRange[0]
      this.searchParams.end = this.timeRange[1]
      this.$emit('onSearch', this.searchParams)
    }
  }
}
</script>

<style scoped>

</style>
